package com.vf.admin.client.controller;

import com.vf.admin.client.common.ClientBaseController;
import com.vf.admin.client.dto.ToUserDto;
import com.vf.admin.client.service.*;
import com.vf.admin.client.service.impl.ZhidingServiceImpl;
import com.vf.admin.common.entity.Result;
import com.vf.admin.common.redis.RedisUtil;
import com.vf.admin.fiwork.controller.AppDailyTasController;
import com.vf.admin.miaodong.entity.AppUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

import static com.vf.admin.utils.StringEx.isNull;

/**
 * @author anxiang
 * @version 1.0.0
 * @ClassName AppCharmProgressController.java
 * @Description TODO 用户
 * @createTime 2021年07月21日 10:58:00
 */
@CrossOrigin
@Controller
@RequestMapping("/app/user/charm")
public class AppCharmProgressController extends ClientBaseController {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    AppSetupService appSetupService;
    @Autowired
    AppDynamicService appDynamicService;
    @Autowired
    AppUserDressupService appUserDressupService;
    @Autowired
    AppUserGiftService appUserGiftService;
    @Autowired
    private AppGiftService appGiftService;
    @Autowired
    AppDynamicDianzanService appDynamicDianzanService;
    @Autowired
    AppFollowService appFollowService;
    @Autowired
    AppUserDongtaiService appUserDongtaiService;
    @Autowired
    AppUserLaHeiService appUserLaHeiService;
    @Autowired
    AppRoomLaHeiService appRoomLaHeiService;
    @Autowired
    AppRoomJinyanService appRoomJinyanService;
    @Autowired
    AppRoomAdminService appRoomAdminService;
    @Autowired
    RedisUtil redisUtil;
    @Autowired
    AppRoomService appRoomService;
    @Autowired
    AppZhiyeFuService appZhiyeFuService;
    @Autowired
    AppZhiyeService appZhiyeService;
    @Autowired
    AppBiaoqianService appBiaoqianService;
    @Autowired
    AppUserService appUserService;
    @Autowired
    private AppMingXiShouLiService appMingXiShouLiService;
    @Autowired
    private AppPriceSetService priceSetService;
    @Autowired
    private AppVisitorService visitorService;
    @Autowired
    private AppMingXiZuanShiService mingXiZuanShiService;
    @Autowired
    private AppMingxiJinbiService mingxiJinbiService;
    @Autowired
    private AppSignatureParseLogService appSignatureParseLogService;
    @Autowired
    private AppAuthUserService appAuthUserService;
    @Autowired
    private AppIntimacyGuardService appIntimacyGuardService;
    @Autowired
    private AppDailyTasController appDailyTasController;
    @Autowired
    private AppInvitationRecordService appInvitationRecordService;
    @Autowired
    private AppSetSameCityService appSetSameCityService;
    @Autowired
    private PopupLogService popupLogService;
    @Autowired
    private AppGuardService appGuardService;
    @Autowired
    private ZhidingServiceImpl zhidingService;
    @Autowired
    private MessageChatFromService messageChatFromService;
    @Autowired
    private LovelyGodLogService lovelyGodLogService;
    @Autowired
    private AppGiftService giftService;
    @Autowired
    private AppUserSettingService appUserSettingService;
    @Autowired
    private SystemAlertService systemAlertService;
    @Autowired
    private AppHeadwearService headwearService;
    @Autowired
    private AppSsProvincesService provincesService;


    /**
     * 查询财富等级 暂时只给用户呢称和用户名
     *
     * @param userid 用户id
     * @return com.vf.admin.common.entity.Result
     * @author anxiang
     * @Description 查询财富等级
     */
    @RequestMapping(value = "/progress", method = RequestMethod.POST)
    @ResponseBody
    public Result lookTinfo(HttpServletRequest request, Integer userID) {
        try {
            if (isNull(userID)) {
                return errorJSON("ID不能为空");
            }
            //根据userid获取最新数据
            AppUser user = appUserService.getTcOrId(userID);
            if (StringUtils.isEmpty(user)) {
                return errorJSON("用户不存在");
            }
            //用户信息转移Dto
            ToUserDto ud = new ToUserDto();
            BeanUtils.copyProperties(user, ud);

            return this.sucessJSON(ud);
        } catch (Exception e) {
            logger.error("查看某个用户的信息异常:", e);
            return this.errorJSON("网络繁忙，请稍后重试");
        }
    }


}
